<template>
  <div class="tab">

    <div :class="selected === 0 ? 'buttonViewSelected' : 'buttonView'" @click="onChartClick">
      <span>学习数据</span>
      <div class="lineView" v-show="selected === 0"></div>
    </div>

    <div :class="selected === 1 ? 'buttonViewSelected' : 'buttonView'" @click="onRankingClick">
      <span>排行榜</span>
      <div class="lineView" v-show="selected === 1"></div>
    </div>

    <div :class="selected === 2 ? 'buttonViewSelected' : 'buttonView'" @click="onTeamClick">
      <span>门店数据</span>
      <div class="lineView" v-show="selected === 2"></div>
    </div>


  </div>
</template>

<script>

  export default {
    name: "UniversityTotalTab",
    props: ['selected'],
    methods: {
      onChartClick() {
        this.$_router.replace("/university/total/chart")
        this.$emit('selectTab', {tab: 0})
      },
      onRankingClick() {
        this.$_router.replace("/university/total/ranking")
        this.$emit('selectTab', {tab: 1})
      },
      onTeamClick() {
        this.$_router.replace("/university/total/team")
        this.$emit('selectTab', {tab: 2})
      },

    },
  }
</script>

<style scoped>
  .tab {
    background-color: white;
    width: 100vw;
    display: flex;
    justify-content: space-between;
    height: 48px;
    border-bottom: #DEDEDE 1px solid;
  }
  .lineView {
    margin-top: -8px;
    background-color: #1DA1F2;
    width: 16px;
    height: 2px;
    border-radius: 1px;
    margin-left: calc(50% - 8px);
  }

  .buttonView {
    height: 48px;
    width: 33.33vw;
    text-align: center;
    line-height: 48px;
    font-size: 14px;
    color: #98999E;
  }

  .buttonViewSelected {
    height: 48px;
    width: 33.33vw;
    text-align: center;
    line-height: 48px;
    font-size: 18px;
    font-weight: bold;
    color: #1DA1F2;
  }


</style>
